<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>LibCDS: /home/zsshen/Desktop/git-hub-code/C-Common-Data-Structures/include/container/hash_map.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">LibCDS
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('hash__map_8h.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">hash_map.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>The unordered map to store key value pairs.  
<a href="#details">More...</a></p>

<p><a href="hash__map_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structHashMap.html">HashMap</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">The implementation for hash map.  <a href="structHashMap.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a9ba28ae908982272687dd668de83780a"><td class="memItemLeft" align="right" valign="top">typedef struct _HashMapData&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="hash__map_8h.html#a9ba28ae908982272687dd668de83780a">HashMapData</a></td></tr>
<tr class="memdesc:a9ba28ae908982272687dd668de83780a"><td class="mdescLeft">&#160;</td><td class="mdescRight">HashMapData is the data type for the container private information.  <a href="#a9ba28ae908982272687dd668de83780a">More...</a><br/></td></tr>
<tr class="separator:a9ba28ae908982272687dd668de83780a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a2af42d6e02f8df6378f225d351781e8f"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="hash__map_8h.html#a2af42d6e02f8df6378f225d351781e8f">HashMapInit</a> (<a class="el" href="structHashMap.html">HashMap</a> **ppObj)</td></tr>
<tr class="memdesc:a2af42d6e02f8df6378f225d351781e8f"><td class="mdescLeft">&#160;</td><td class="mdescRight">The constructor for <a class="el" href="structHashMap.html" title="The implementation for hash map. ">HashMap</a>.  <a href="#a2af42d6e02f8df6378f225d351781e8f">More...</a><br/></td></tr>
<tr class="separator:a2af42d6e02f8df6378f225d351781e8f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7d5068c7220d92b84e4cede75ff3fb15"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="hash__map_8h.html#a7d5068c7220d92b84e4cede75ff3fb15">HashMapDeinit</a> (<a class="el" href="structHashMap.html">HashMap</a> **ppObj)</td></tr>
<tr class="memdesc:a7d5068c7220d92b84e4cede75ff3fb15"><td class="mdescLeft">&#160;</td><td class="mdescRight">The destructor for <a class="el" href="structHashMap.html" title="The implementation for hash map. ">HashMap</a>.  <a href="#a7d5068c7220d92b84e4cede75ff3fb15">More...</a><br/></td></tr>
<tr class="separator:a7d5068c7220d92b84e4cede75ff3fb15"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a243335e4bfd9e7efb7f5e7925c4d0d74"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="hash__map_8h.html#a243335e4bfd9e7efb7f5e7925c4d0d74">HashMapPut</a> (<a class="el" href="structHashMap.html">HashMap</a> *self, Pair *pPair, size_t size)</td></tr>
<tr class="memdesc:a243335e4bfd9e7efb7f5e7925c4d0d74"><td class="mdescLeft">&#160;</td><td class="mdescRight">Insert a key value pair into the map.  <a href="#a243335e4bfd9e7efb7f5e7925c4d0d74">More...</a><br/></td></tr>
<tr class="separator:a243335e4bfd9e7efb7f5e7925c4d0d74"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a949863ffee4bf0b02e80953dc989a828"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="hash__map_8h.html#a949863ffee4bf0b02e80953dc989a828">HashMapGet</a> (<a class="el" href="structHashMap.html">HashMap</a> *self, Key key, size_t size, Value *pValue)</td></tr>
<tr class="memdesc:a949863ffee4bf0b02e80953dc989a828"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieve the value corresponding to the designated key.  <a href="#a949863ffee4bf0b02e80953dc989a828">More...</a><br/></td></tr>
<tr class="separator:a949863ffee4bf0b02e80953dc989a828"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a529685800e567cf5b960a81c17c1aa1d"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="hash__map_8h.html#a529685800e567cf5b960a81c17c1aa1d">HashMapFind</a> (<a class="el" href="structHashMap.html">HashMap</a> *self, Key key, size_t size)</td></tr>
<tr class="memdesc:a529685800e567cf5b960a81c17c1aa1d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if the map contains the designated key.  <a href="#a529685800e567cf5b960a81c17c1aa1d">More...</a><br/></td></tr>
<tr class="separator:a529685800e567cf5b960a81c17c1aa1d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1f245b96b890186f93987728f2dea402"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="hash__map_8h.html#a1f245b96b890186f93987728f2dea402">HashMapRemove</a> (<a class="el" href="structHashMap.html">HashMap</a> *self, Key key, size_t size)</td></tr>
<tr class="memdesc:a1f245b96b890186f93987728f2dea402"><td class="mdescLeft">&#160;</td><td class="mdescRight">Delete the key value pair corresponding to the designated key.  <a href="#a1f245b96b890186f93987728f2dea402">More...</a><br/></td></tr>
<tr class="separator:a1f245b96b890186f93987728f2dea402"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8af14c3c4205f0a0b2a1dd75694b3bf4"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="hash__map_8h.html#a8af14c3c4205f0a0b2a1dd75694b3bf4">HashMapSize</a> (<a class="el" href="structHashMap.html">HashMap</a> *self)</td></tr>
<tr class="memdesc:a8af14c3c4205f0a0b2a1dd75694b3bf4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the number of stored key value pairs.  <a href="#a8af14c3c4205f0a0b2a1dd75694b3bf4">More...</a><br/></td></tr>
<tr class="separator:a8af14c3c4205f0a0b2a1dd75694b3bf4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aba029e83455fdbaf0d8a464dc4e3d381"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="hash__map_8h.html#aba029e83455fdbaf0d8a464dc4e3d381">HashMapIterate</a> (<a class="el" href="structHashMap.html">HashMap</a> *self, bool bReset, Pair **ppPair)</td></tr>
<tr class="memdesc:aba029e83455fdbaf0d8a464dc4e3d381"><td class="mdescLeft">&#160;</td><td class="mdescRight">Iterate through the map to retrieve each key value pair.  <a href="#aba029e83455fdbaf0d8a464dc4e3d381">More...</a><br/></td></tr>
<tr class="separator:aba029e83455fdbaf0d8a464dc4e3d381"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af937beb03d236fd4dc9a846fcb97eff4"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="hash__map_8h.html#af937beb03d236fd4dc9a846fcb97eff4">HashMapSetDestroy</a> (<a class="el" href="structHashMap.html">HashMap</a> *self, void(*pFunc)(Pair *))</td></tr>
<tr class="memdesc:af937beb03d236fd4dc9a846fcb97eff4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the custom key value pair resource clean method.  <a href="#af937beb03d236fd4dc9a846fcb97eff4">More...</a><br/></td></tr>
<tr class="separator:af937beb03d236fd4dc9a846fcb97eff4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abbce9df57c7395e441c226919937d67f"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="hash__map_8h.html#abbce9df57c7395e441c226919937d67f">HashMapSetHash</a> (<a class="el" href="structHashMap.html">HashMap</a> *self, uint32_t(*pFunc)(Key, size_t))</td></tr>
<tr class="memdesc:abbce9df57c7395e441c226919937d67f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the custom hash function.  <a href="#abbce9df57c7395e441c226919937d67f">More...</a><br/></td></tr>
<tr class="separator:abbce9df57c7395e441c226919937d67f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>The unordered map to store key value pairs. </p>

<p>Definition in file <a class="el" href="hash__map_8h_source.html">hash_map.h</a>.</p>
</div><h2 class="groupheader">Typedef Documentation</h2>
<a class="anchor" id="a9ba28ae908982272687dd668de83780a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct _HashMapData <a class="el" href="hash__map_8h.html#a9ba28ae908982272687dd668de83780a">HashMapData</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>HashMapData is the data type for the container private information. </p>

<p>Definition at line <a class="el" href="hash__map_8h_source.html#l00011">11</a> of file <a class="el" href="hash__map_8h_source.html">hash_map.h</a>.</p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a2af42d6e02f8df6378f225d351781e8f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t HashMapInit </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structHashMap.html">HashMap</a> **&#160;</td>
          <td class="paramname"><em>ppObj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>The constructor for <a class="el" href="structHashMap.html" title="The implementation for hash map. ">HashMap</a>. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ppObj</td><td>The double pointer to the to be constructed map</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td></td></tr>
    <tr><td class="paramname">ERR_NOMEM</td><td>Insufficient memory for map construction </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a7d5068c7220d92b84e4cede75ff3fb15"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void HashMapDeinit </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structHashMap.html">HashMap</a> **&#160;</td>
          <td class="paramname"><em>ppObj</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>The destructor for <a class="el" href="structHashMap.html" title="The implementation for hash map. ">HashMap</a>. </p>
<p>If the custom resource clean method is set, it also runs the clean method for each pair.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ppObj</td><td>The double pointer to the to be destructed map </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a243335e4bfd9e7efb7f5e7925c4d0d74"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t HashMapPut </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structHashMap.html">HashMap</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Pair *&#160;</td>
          <td class="paramname"><em>pPair</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Insert a key value pair into the map. </p>
<p>This function inserts a key value pair into the map. If the hash key of the designated pair is the same with a certain one stored in the map, that pair will be replaced. Also, if the custom resource clean method is set, it runs the resource clean method for the replaced pair.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to <a class="el" href="structHashMap.html" title="The implementation for hash map. ">HashMap</a> structure </td></tr>
    <tr><td class="paramname">pPair</td><td>The pointer to the designated pair </td></tr>
    <tr><td class="paramname">size</td><td>Key size in bytes</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td></td></tr>
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
    <tr><td class="paramname">ERR_NOMEM</td><td>Insufficient memory for map extension </td></tr>
    <tr><td class="paramname">ERR_KEYSIZE</td><td>Invalid key size </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a949863ffee4bf0b02e80953dc989a828"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t HashMapGet </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structHashMap.html">HashMap</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Key&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Value *&#160;</td>
          <td class="paramname"><em>pValue</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Retrieve the value corresponding to the designated key. </p>
<p>This function retrieves the value corresponding to the designated key from the map. If the key can be found, the value will be returned by the fourth parameter. Otherwise, the error code is returned and the fourth parameter is updated with NULL.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to <a class="el" href="structHashMap.html" title="The implementation for hash map. ">HashMap</a> structure </td></tr>
    <tr><td class="paramname">key</td><td>The designated key </td></tr>
    <tr><td class="paramname">size</td><td>Key size in bytes </td></tr>
    <tr><td class="paramname">pValue</td><td>The pointer to the returned value</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td></td></tr>
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
    <tr><td class="paramname">ERR_NODATA</td><td>No map entry can be found </td></tr>
    <tr><td class="paramname">ERR_GET</td><td>Invalid parameter to store returned value </td></tr>
    <tr><td class="paramname">ERR_KEYSIZE</td><td>Invalid key size</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>The key should be the pointer to the data you plan to hash for. </dd></dl>

</div>
</div>
<a class="anchor" id="a529685800e567cf5b960a81c17c1aa1d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t HashMapFind </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structHashMap.html">HashMap</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Key&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Check if the map contains the designated key. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to <a class="el" href="structHashMap.html" title="The implementation for hash map. ">HashMap</a> structure </td></tr>
    <tr><td class="paramname">key</td><td>The designated key </td></tr>
    <tr><td class="paramname">size</td><td>Key size in bytes</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td>The key can be found </td></tr>
    <tr><td class="paramname">NOKEY</td><td>The key cannot be found </td></tr>
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
    <tr><td class="paramname">ERR_KEYSIZE</td><td>Invalid key size</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>The key should be the pointer to the data you plan to hash for. </dd></dl>

</div>
</div>
<a class="anchor" id="a1f245b96b890186f93987728f2dea402"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t HashMapRemove </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structHashMap.html">HashMap</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Key&#160;</td>
          <td class="paramname"><em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Delete the key value pair corresponding to the designated key. </p>
<p>This function deletes the key value pair corresponding to the designated key. If the custom resource clean method is set, it also runs the clean method for the deleted pair.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to <a class="el" href="structHashMap.html" title="The implementation for hash map. ">HashMap</a> structure </td></tr>
    <tr><td class="paramname">key</td><td>The designated key </td></tr>
    <tr><td class="paramname">size</td><td>Key size in bytes</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td></td></tr>
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
    <tr><td class="paramname">ERR_NODATA</td><td>No map entry can be found </td></tr>
    <tr><td class="paramname">ERR_KEYSIZE</td><td>Invalid key size</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>The key should be the pointer to the data you plan to hash for. </dd></dl>

</div>
</div>
<a class="anchor" id="a8af14c3c4205f0a0b2a1dd75694b3bf4"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t HashMapSize </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structHashMap.html">HashMap</a> *&#160;</td>
          <td class="paramname"><em>self</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Return the number of stored key value pairs. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to <a class="el" href="structHashMap.html" title="The implementation for hash map. ">HashMap</a> structure</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of stored pairs </dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="aba029e83455fdbaf0d8a464dc4e3d381"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t HashMapIterate </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structHashMap.html">HashMap</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>bReset</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Pair **&#160;</td>
          <td class="paramname"><em>ppPair</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Iterate through the map to retrieve each key value pair. </p>
<p>Before iterating through the map, it is necessary to pass:</p>
<ul>
<li>bReset = true</li>
<li>pPair = NULL for iterator initialization.</li>
</ul>
<p>After initialization, you can pass:</p>
<ul>
<li>bReset = false</li>
<li>pPair = the pointer to get the returned pair at each iteration.</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to <a class="el" href="structHashMap.html" title="The implementation for hash map. ">HashMap</a> structure </td></tr>
    <tr><td class="paramname">bReset</td><td>The knob to restart the iteration </td></tr>
    <tr><td class="paramname">ppPair</td><td>The double pointer to the returned pair</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td>Iterator initialized successfully </td></tr>
    <tr><td class="paramname">CONTINUE</td><td>Iteration in progress </td></tr>
    <tr><td class="paramname">END</td><td>Iteration terminiated </td></tr>
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
    <tr><td class="paramname">ERR_GET</td><td>Invalid parameter to store returned pair</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>Please do not insert or delete pairs during map traversal </dd></dl>

</div>
</div>
<a class="anchor" id="af937beb03d236fd4dc9a846fcb97eff4"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t HashMapSetDestroy </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structHashMap.html">HashMap</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void(*)(Pair *)&#160;</td>
          <td class="paramname"><em>pFunc</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the custom key value pair resource clean method. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to <a class="el" href="structHashMap.html" title="The implementation for hash map. ">HashMap</a> structure </td></tr>
    <tr><td class="paramname">pFunc</td><td>The function pointer to the custom method</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td></td></tr>
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="abbce9df57c7395e441c226919937d67f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t HashMapSetHash </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structHashMap.html">HashMap</a> *&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t(*)(Key, size_t)&#160;</td>
          <td class="paramname"><em>pFunc</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the custom hash function. </p>
<p>The default hash function is HashMurMur32.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>The pointer to <a class="el" href="structHashMap.html" title="The implementation for hash map. ">HashMap</a> structure </td></tr>
    <tr><td class="paramname">pFunc</td><td>The function pointer to the custom method</td></tr>
  </table>
  </dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
  <table class="retval">
    <tr><td class="paramname">SUCC</td><td></td></tr>
    <tr><td class="paramname">ERR_NOINIT</td><td>Uninitialized container </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_e0f5f6345e438c73b9ae78ec2940718c.html">container</a></li><li class="navelem"><a class="el" href="hash__map_8h.html">hash_map.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>
